package 算法.微众;

import java.util.Scanner;

/**
 * @author:谢君臣
 * @Date:2021/9/10-20:54
 * @version:1.0
 * @function:
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        for (int j =0; j < t; j++){
            int x = scanner.nextInt();
            for (int i = 0; i < Math.ceil(Math.pow(x,1d/3)); i++){
                for (int m = 0; m < Math.ceil(Math.pow(x-Math.pow(i,1d/3), 1d/4)); m++){
                    for (int n = 0; n < Math.ceil(Math.pow((x-Math.pow(i,1d/3)-Math.pow(m,1d/4)),1d/5)); n++){
                        if (Math.pow(i,3)+Math.pow(m,4)+Math.pow(n,5) == x){
                            System.out.println("YES");
                            break;
                        }
                    }
                }
            }
            System.out.println("NO");

        }
    }
}
